﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo13
{
    class Program
    {
        static void Main(string[] args)
        {

            try
            {
                float sum = 0;
                int count = 0;
                float avg = 0;
                while (true)
                {
                    Console.WriteLine("请输入考生成绩：");
                    float a = float.Parse(Console.ReadLine());
                    if (a == -1)
                    {
                        break;
                    }
                    else
                    {
                        sum = sum + a;
                        count = count + 1;
                        avg = sum / count;
                    }
                }
                Console.WriteLine("学生总数{0}，总分数{1}，平均分{2}", count, sum, avg);

            }
            catch (FormatException)
            {
                Console.WriteLine("异常已处理");
            }
            catch (OverflowException)
            {
                Console.WriteLine("数值超出范围，异常已处理");
            }
            catch (Exception)
            {
                Console.WriteLine("异常已处理！");
            }
            finally
            {
                Console.WriteLine("无异常。");
            }

        }


    }

   
}
